#ifndef _STATE_H
#define _STATE_H

#include "SFML\System.hpp"
#include "RenderManager.h"
#include "ControlState.h"
#include <string>

class StateManager;
class State
{
public:
	State(void);
	virtual ~State(void);

	StateManager* getStateManager() { return _stateManager; }

	virtual void shutdown() = 0;
	virtual void initialize() = 0;
	virtual void update() = 0;
	virtual void draw(RenderManager* renderManager) = 0;
	virtual void input() = 0;
	virtual void loadContent() = 0;
	virtual void unloadContent() = 0;

	void setInputUpdate(bool value) { _controlState->setUpdateState(value); }
	void setUpdateState(bool value) { _update = value; }
	void setDrawState(bool value) { _draw = value; }
	void setActiveState(bool value);
	bool getUpdateState() { return _update; }
	bool getDrawState() { return _draw; }
	std::string& getID() { return _id; }

	bool isActive();
	
	void setInputManager(std::shared_ptr<InputManager> inputManager) 
	{ _inputManager = inputManager; _controlState = std::shared_ptr<ControlState>(new ControlState(inputManager)); }
	void setStateManager(StateManager* stateManager) { _stateManager = stateManager; }
	void setSkipUpdateCycles(short value) { _skipUpdate = value; }
	void decrementSkipCycle() { _skipUpdate--; }
	
protected:
	std::shared_ptr<ControlState> _controlState;
	std::shared_ptr<InputManager> _inputManager;
	StateManager* _stateManager;
	std::string _id;
	bool _update;
	bool _draw;
	short _skipUpdate;
};

#endif // _STATE_H